/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kurvykurvy.image;

import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.event.InputEvent;
import javax.swing.JComponent;
import javax.swing.TransferHandler;

/**
 *
 * @author HY
 */
public class LoadedImageExportTransferHandler
        extends TransferHandler
{
    public LoadedImageExportTransferHandler()
    {
    }

    @Override
    public void exportAsDrag( JComponent comp, InputEvent e, int action )
    {
        System.out.println( "Exporting : " + comp.getClass() );
        super.exportAsDrag( comp, e, action );
    }

    @Override
    protected void exportDone( JComponent source, Transferable data, int action )
    {
        System.out.println( "Export complete for : " + source.getClass() );
        super.exportDone( source, data, action );
    }

    @Override
    protected Transferable createTransferable( JComponent c )
    {
        System.out.println( "Create Transferrable for : " + c.getClass() );
        if ( c instanceof ImageSlide )
        {
            return ((ImageSlide) c).getImage();
        }
        else
        {
            return super.createTransferable( c );
        }
    }
}
